program A1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils;

var
  f, g: TextFile;
  answer: Int64;
  S: String;
  N: Integer;
  T: Word;
type
  CharArray = Array of Char;
  IntArray = Array of Integer;
function DoesVowelExists(var sm: CharArray; n: Integer): Boolean;
var
  i: Integer;
begin
  Result := False;
  for i := 0 to n - 1 do begin
    Result := sm[i] in ['a', 'e', 'i', 'o', 'u'];
    if Result then
      Break;
  end;
end;

function findallntuples(S: String; n: Integer; out A: IntArray): Integer;
var
  i, j: Integer;
  sm: CharArray;
  VowelExists, JumpOccured: Boolean;
begin
  Result := 0;
  SetLength(sm, n);
  for i := 0 to n - 1 do
    sm[i] := S[i + 1];
  VowelExists := DoesVowelExists(sm, n);
  if not VowelExists then begin
    Inc(Result);
    SetLength(A, Result);
    A[Result - 1] := 1;
    i := 2;
    JumpOccured := false;
  end else begin
    i := n + 1;
    JumpOccured := True;
  end;
  while (i <= Length(S) - n + 1) do begin
    if JumpOccured then begin
      for j := 0 to n - 1 do
        sm[j] := S[i + j];
    end else
      sm[(i-2) mod n] := s[n + i - 1];
    VowelExists := DoesVowelExists(sm, n);
    if not VowelExists then begin
      Inc(Result);
      SetLength(A, Result);
      A[Result - 1] := i;
      Inc(i);
      JumpOccured := false;
    end else begin
      Inc(i, n);
      JumpOccured := True;
     end;
  end;

end;

function findnvalue(S: String; n: Integer): Integer;
var
  A: IntArray;
begin
  Result := findallntuples(S, n, A);
end;

function findResult(S: String; n: Integer): Integer;
var
  A: IntArray;
  i, nvalue, L, R: Integer;
begin
  nvalue := findallntuples(S, n, A);
  case nvalue of
  0: Result := 0;
  else begin
    Result := 0;
    SetLength(A, Length(A) + 1);
    A[High(A)] := Length(S) - n + 2;
    for I := Low(A) to High(A) - 1  do begin
      L := A[i];
      R := A[i + 1] - A[i];
      Result := Result + L * R;
    end;

  end;
  end;

end;

procedure Split(S: String; delimiter: Char; out S1, S2: String);
var
  i: Integer;
begin
  i := Pos(delimiter, S);
  S1 := Copy(S, 1, i - 1);
  S2 := Copy(S, i + 1, Length(S) - i);
end;

procedure Test;
var
  s, s1, s2: String;
begin
  S := 'asdf fdas';
  Split(S, ' ', S1, s2);
  Writeln(' S = ', S);
  Writeln(' S1 = ', S1);
  Writeln(' S2 = ', S2);
end;

procedure ReadData;
var
  sss, s1, s2: String;
begin
  Readln(f, sss);
  Split(sss, ' ', s1, s2);
  S := s1;
  N := StrToInt(s2);
end;

procedure ProcessData;
begin
  answer := findResult(S, N);
end;


procedure OutputVerdict(casenum: Word);
begin
  writeln(g, 'Case #', casenum, ': ', answer);
  writeln('Case #', casenum, ': ', answer);
end;

var
  i: Word;
  Ss: String;

begin
 // Test;
  {writeln(findnvalue('fffaaabcdaeizyx', 3));
  writeln(findResult('fffaaabcdaeizyx', 3));
  writeln(findnvalue('fffaaabcdaeizyxoui', 3));
  writeln(findResult('fffaaabcdaeizyxoui', 3));
  Readln;
  Halt;
  }
  try
    sS := ParamStr(1);
    if (sS = '') then
       Ss := 'input.txt';
    AssignFile(f, Ss);
    Reset(f);
    AssignFile(g, 'output11.txt');
    Rewrite(g);
    try
      Readln(f, T);
      for i := 1 to T do begin
        ReadData;
        ProcessData;
        OutputVerdict(i);
      end;
    finally
      CloseFile(f);
      CloseFile(g);
    end;
    writeln('Reading finished');
    Readln;
  except
    on E: Exception do begin
      Writeln(E.ClassName, ': ', E.Message);
      readln;
    end;
  end;
end.
